add

public abstract JsSet add(@Nullable() Object element)

Adds the specified element to this set.

The type mapping rules are the following:


| Java               | JavaScript                    |
|--------------------|-------------------------------|
| Double             | Number                        |
| String             | String                        |
| Boolean            | Boolean                       |
| null               | null                          |
| JsObject           | Object                        |
| Node               | Node                          |
| List<?>            | Array or Proxy Object         |
| Set<?>             | Set or Proxy Object           |
| Map<?,?>           | Map or Proxy Object           |
| byte[]             | ArrayBuffer                   |
| Object             | Proxy Object                  |

If you pass a non-primitive Java object to JavaScript, it will be converted into a "proxy" JavaScript object. Method and property calls to this object will be delegated to the Java object. For security reasons, JavaScript can access only those methods and fields of the injected Java object that are explicitly marked as accessible either using the JsAccessible annotation or via the JsAccessibleTypes class.

Java collections that are not made accessible to JavaScript using the JsAccessible annotation or via the JsAccessibleTypes class are converted to JavaScript collections. The content of the converted collection is a deep copy of the Java collection. Modifications of the converted collection in JavaScript do not affect the collection in Java.

Java collections that are made accessible to JavaScript using the JsAccessible annotation or via the JsAccessibleTypes class are wrapped into a JavaScript proxy object. Such proxy objects can be used to modify the collection in Java.

Return

this set

Parameters

element

the element to insert

Throws

when element is a JsObject from a different web page or frame

when the JavaScript object is already disposed or invalid